home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_08 / xmpl_01.sx next >
Encoding:
Text File  |  1996-05-21  |  425 b   |  19 lines  |  [TEXT/R*ch]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 8, example 1
  5.  
  6. -- example of guarded code
  7. unglobal myArray, otherArray
  8.  
  9. global myArray := new Array initialSize:10 growable:false
  10. global otherArray := #(1,2,3,4,5,6,7,8,9,10,11,12)
  11.  
  12. -- now try to add too many items to an array
  13. guard
  14.     addMany myArray otherArray  
  15. catching
  16.     boundedError: caught (print "Tried to add too many items" debug)
  17. end
  18. -->>>
  19.